import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import PageChange from "../zuoye/PageChange.vue";
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/PageChange',
    name: 'PageChange',
    component: PageChange
  },
  {
    path: '/PageHospital',
    name: 'PageHospital',
    component: () => import('../zuoye/PageHospital.vue')
  },
  {
    path: '/PageMath',
    name: 'PageMath',
    component: () => import('../zuoye/PageMath.vue')
  },
  {
    path: '/PageMain',
    name: 'main',
    component: () => import('../day05/main.vue')
  },
  {
    path: '/PageDay06',
    name: 'PageDay06',
    component: () => import('../day06/main.vue')
  },
  {
    path: '/PageDay07',
    name: 'PageDay07',
    component: () => import('../day07/main.vue')
  },
  {
    path: '/PageDay07',
    component: () => import('../day07/main.vue'),
    children: [
      {
        path: '/Rt/:id/:name',
        name: 'Rt',
        component: () => import('../day07/RouterLink/RouterLink.vue')
      },
      {
        path: '/Rt1',
        name: 'Rt1',
        props: { postId: 1 },
        component: () => import('../day07/RouterLink/RouterLink.vue')
      },
      {
        path: '/1',
        redirect: '/Rt1',
        component: HomeView,
      },
      {
        path: '/PageHospital1',
        name: 'PageHospital1',
        component: () => import('../zuoye/PageHospital.vue')
      },
      {
        path: '/home1',
        name: 'home1',
        component: () => import('../day07/mianjing/Home.vue'),
        redirect: '/home1/index',
        children: [
          {
            path: '/favorite',
            name: 'favorite',
            component: () => import('../day07/mianjing/home/Favorite.vue')
          },
          {
            path: 'index',
            name: 'shouye',
            component: () => import('../day07/mianjing/home/Index.vue'),
            meta: {
              keepAlive: true
            },
            props: {
              keepAlive: true
            }
          },
          {
            path: 'my',
            name: 'my',
            component: () => import('../day07/mianjing/home/My.vue')
          },
          {
            path: 'shoucang',
            name: 'shoucang',
            component: () => import('../day07/mianjing/home/ShouCang.vue')
          }
        ]
      },
      {
        path: '/login',
        name: 'login',
        component: () => import('../day07/mianjing/login.vue')
      },
      {
        path: '/register',
        name: 'register',
        component: () => import('../day07/mianjing/Register.vue')
      }
    ]
  },
  {
    path: '/PageDay08',
    name: 'PageDay08',
    component: () => import('../day08/main.vue')
  },
  {
    path: '/PageDay09',
    name: 'PageDay09',
    component: () => import('../day09/main.vue')
  },
  {
    path: '/detail/:id',
    name: 'detail',
    component: () => import('../day07/mianjing/Detail.vue')
  },
  //放在最后,如果有不成功则直接跳转到404
  //path使用*通配符进行匹配
  {
    path: '*',
    name: '404',
    component: () => import('../day07/RouterLink/404.vue')
  },

]

const router = new VueRouter({
  mode: 'hash',
  routes,
  /*
   替换类名 
   linkActiveClass:'active1',
   linkExactActiveClass:'active2' 
  */
})

export default router
